#include "stdafx.h"
#include "Task.h"

double Task::getK( double x )
{
	double k;
	switch (type)
	{
	case TaskTypeTesting: 
		if (x < gapPoint) k = exp(-gapPoint);
		else k = gapPoint*gapPoint + 1;
		break;
	case TaskTypeMyTask: 
		if (x < gapPoint) k = exp((-1) * x);
		else k = x*x + 1;
		break;
	}
	return k;
}

double Task::getQ( double x )
{
	double q;
	switch (type)
	{
	case TaskTypeTesting: 
		if (x < gapPoint) q = gapPoint*gapPoint*gapPoint + 1;
		else q = gapPoint;
		break;
	case TaskTypeMyTask: 
		if (x < gapPoint) q = x*x*x + 1;
		else q = x;
		break;
	}
	return q;
}


double Task::getF( double x )
{
	double f;
	switch (type)
	{
	case TaskTypeTesting: 
		if (x < gapPoint) f = gapPoint*gapPoint - 1;
		else f = 1;
		break;
	case TaskTypeMyTask: 
		if (x < gapPoint) f = x*x - 1;
		else f = 1;
		break;
	}
	return f;
}
